import request from '/@/utils/request';

/**
 * 获取租户列表
 * @link 参考：https://api.lmabbe.com/doc.html#/platform/%E7%A7%9F%E6%88%B7%E7%AE%A1%E7%90%86/listUsingGET_2
 * @param params 要传的参数值，非必传
 * @returns 返回接口数据
 */
export function getDictList(params?: object) {
	return request({
		url: '/core/sysDic/page',
		method: 'get',
		params,
	});
}

/**
 * 获取租户详情
 * @link 参考：https://api.lmabbe.com/doc.html#/platform/%E7%A7%9F%E6%88%B7%E7%AE%A1%E7%90%86/getByIdUsingGET
 * @param params 要传的参数值，非必传
 * @returns 返回接口数据
 */
export function getDictItems(dicId?: any, params?: object) {
	return request({
		url: `/core/sysDic/${dicId}/items`,
		method: 'get',
		params,
	});
}

/**
 * 新增租户信息
 * @link 参考：https://api.lmabbe.com/doc.html#/platform/%E7%A7%9F%E6%88%B7%E7%AE%A1%E7%90%86/addUsingPOST
 * @param params 要传的参数值，非必传
 * @returns 返回接口数据
 */
export function addDict(params?: object) {
	return request({
		url: '/core/sysDic',
		method: 'post',
		data: params,
	});
}

/**
 * 修改租户信息
 * @link 参考：https://api.lmabbe.com/doc.html#/platform/%E7%A7%9F%E6%88%B7%E7%AE%A1%E7%90%86/updateUsingPUT
 * @param params 要传的参数值，非必传
 * @returns 返回接口数据
 */
export function editDict(params?: object, dicId?: any) {
	return request({
		url: `/core/sysDic/${dicId}`,
		method: 'put',
		data: params,
	});
}

export function getDictDetail(dicId?: any) {
	return request({
		url: `/core/sysDic/${dicId}`,
		method: 'get',
	});
}

export function delDict(dicId?: any) {
	return request({
		url: `/core/sysDic/${dicId}`,
		method: 'delete',
	});
}

export function addDictItem(dicId: any, params?: object) {
	return request({
		url: `/core/sysDic/${dicId}/item`,
		method: 'post',
		data: params,
	});
}

export function getDictItemDetail(itemId?: any) {
	return request({
		url: `/core/sysDic/item/${itemId}`,
		method: 'get',
	});
}

export function editDictItem(dicId: String, itemId: any, params: object) {
	return request({
		url: `/core/sysDic/${dicId}/item/${itemId}`,
		method: 'put',
		data: params,
	});
}

export function delDictItem(itemId: any) {
	return request({
		url: `/core/sysDic/item/${itemId}`,
		method: 'delete',
	});
}

export function getAllDictTree(params?: object) {
	return request({
		url: '/core/sysDic/allTree',
		method: 'get',
		params,
	});
}
